#ifndef _NE_VIEWPORT_H_
#define _NE_VIEWPORT_H_

#include <graphics/Camera.h>

namespace ne
{
    class NEAPI Viewport
    {
        public:
            explicit Viewport(Camera *camera);

            void setCamera(Camera *camera);
            Camera* getCamera() const;

            void setPosition(const real x, const real y);
            void setPosition(const Vector2 &v);
            Vector2 getPosition() const;

            void resize(const uint32_t width, const uint32_t height);

            void setWidth(const uint32_t width);
            uint32_t getWidth() const;

            void setHeight(const uint32_t height);
            uint32_t getHeight() const;

            // Get the World Ray from the Viewport
            // The origin is the Position of World
            Ray getScreenToWorldRay(const real x, const real y) const;
            void getScreenToWorldRay(const real x, const real y, Ray &outRay) const;

            // Get the Camera Ray from the Viewport
            // The origin is the Position of Camera
            Ray getScreenToCameraRay(const real x, const real y) const;
            void getScreenToCameraRay(const real x, const real y, Ray &outRay) const;

            Vector2 getScreenToViewport(const real x, const real y) const;

            virtual ~Viewport();

        private:
            Viewport();

            Viewport(const Viewport &);

            Viewport& operator = (const Viewport &);

        private:
            Camera *mCamera;
            Vector2 mPosition;
            uint32_t mWidth;
            uint32_t mHeight;
    };
}

#endif
